package com.zyh.demo;


class Student1 {
    static int num;//0

    static {
        System.out.println("静态代码块执行num" + ++num);//1
    }

    {
        System.out.println("构造代码块执行num" + ++num);//2//5
    }

    public Student1() {
        System.out.println("无参构造方法在执行num" + ++num);//最后输出6
    }

    public Student1(int number) {
        this();//3
        System.out.println("有参构造方法在执行num" + ++num);//4
    }
}

public class BlockDemo {
    public static void main(String[] args) {
        new Student1(3);
        new Student1();
    }
}
